##############################################################
## MOD Title:    
## MOD Author: Wertos < admin@supporttp.ru > http://supporttp.ru/
## MOD Adapted: Dream
## MOD Description:    .      vBulletin.    ajax    Jquery
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Files To Edit: 
##         ./includes/init_bb.php
##         ./viewforum.php
##         ./templates/{you_theme}/viewforum.tpl 
##         ./templates/{you_theme}/css/main.css
## Included Files: rate_topic.php
##############################################################

  

CREATE TABLE `bb_topic_rate` (
  `topic_id` mediumint(8) NOT NULL,
  `user_id` mediumint(8) NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;

ALTER TABLE `bb_topics` ADD `topic_rate` INT( 3 ) NOT NULL DEFAULT '0'

# 
#-----[ OPEN ]-[  ]------------------------------ 
# 

includes/init_bb.php

# 
#-----[ FIND ]-[  ]-------------------------------- 
#

define('BB_ATTACHMENTS',          'bb_attachments');

 

define('BB_TOPIC_RATE',           'bb_topic_rate');

# 
#-----[ OPEN ]-[  ]------------------------------ 
# 

./viewtopic.php

# 
#-----[ FIND ]-[  ]-------------------------------- 
#
$topic_time  = $t_data['topic_time'];

# 
#-----[ AFTER, ADD ]-[   ]----------------- 
#
$topic_rate  = $t_data['topic_rate'];
  $template->assign_vars(array(
    'TOPIC_RATE'=> $topic_rate,
  ));


# 
#-----[ OPEN ]-[  ]------------------------------ 
# 

./viewforum.php

# 
#-----[ FIND ]-[  ]-------------------------------- 
#

  $t_hot    = ($replies >= $bb_cfg['hot_threshold']);
  $t_type   = $topic['topic_type'];

# 
#-----[ AFTER, ADD ]-[   ]----------------- 
#

  $topic_rate = (int) $topic['topic_rate'];
# 
#-----[ FIND ]-[  ]-------------------------------- 
#

      define('NORMAL_SEP', true);
      $separator = $lang['Topics_Normal'];
    }
  }


# 
#-----[ AFTER, ADD ]-[   ]----------------- 
#
   $rate = 0;
   $rate_img = '';
   while ($rate < $topic_rate)
   {
		$rate++;
		$rate_img .= '<img align="right" src="'.$bb_cfg['script_path'].'templates/'.$bb_cfg['tpl_name'].'/images/star_small.gif" />';
	}

# 
#-----[ FIND ]-[  ]-------------------------------- 
#
$template->assign_block_vars('t', array(

# 
#-----[ AFTER, ADD ]-[   ]----------------- 
#

    'RATE_IMG'         => $rate_img,


# 
#-----[ OPEN ]-[  ]------------------------------ 
# 

language/{you_language}/lang_main.php

# 
#-----[ ADD ]-[  ]----------------- 
#
$lang['RATE_TOPIC'] = '  ';
$lang['NO_RATE'] = '  ';
$lang['NO_TOPIC_ID'] = 'ID   ';
$lang['NO_RATE_GUEST'] = '   ';
$lang['YOU_ARE_RATE'] = '     ';

# 
#-----[ OPEN ]-[  ]------------------------------ 
# 

templates/{you_theme}/viewtopic.tpl 

# 
#-----[ FIND ]-[  ]-------------------------------- 
#
		<td class="small bold nowrap tRight" width="100%">
			&nbsp;
			<!-- IF LOGGED_IN -->
			<a class="small" href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a> &nbsp;<span style="color:#CDCDCD;">|</span>&nbsp;
			<a class="menu-root" href="#topic-options">{L_DISPLAYING_OPTIONS}</a>


# 
#-----[ BEFORE ADD ]-[   ]----------------- 
#

		<td style="width: 28%">&nbsp;</td>
		<td style="width: 28%;" class="bold small">{L_RATE_TOPIC}</td>
		<td><div id="rate" class="rate"></div></td>
		<script type="text/javascript">
		  $('#rate').rater('rate_topic.php?t={TOPIC_ID}', {maxvalue:10, style: 'basic', curvalue:{TOPIC_RATE}});
		</script>      

# 
#-----[ OPEN ]-[  ]------------------------------ 
# 

templates/{you_theme}/viewforum.tpl 

# 
#-----[ FIND ]-[  ]-------------------------------- 
#
      <a id="tt-{t.TOPIC_ID}" href="{TOPIC_URL}{t.HREF_TOPIC_ID}" class="gen tt-text">{t.TOPIC_TITLE}</a>
 
# 
#-----[ AFTER, ADD ]-[   ]----------------- 
#

{t.RATE_IMG}

# 
#-----[ FIND ]-[  ]-------------------------------- 
#
			{t.TOR_TYPE}<a id="tt-{t.TOPIC_ID}" href="{TOPIC_URL}{t.HREF_TOPIC_ID}" class="torTopic tt-text"><b>{t.TOPIC_TITLE}</b></a>
 
# 
#-----[ AFTER, ADD ]-[   ]----------------- 
#

{t.RATE_IMG}

# 
#-----[ FIND ]-[  ]-------------------------------- 
#
			<!-- IF t.POLL --><span class="topicPoll">{L_TOPIC_POLL}</span><!-- ENDIF -->
			<a id="tt-{t.TOPIC_ID}" href="{TOPIC_URL}{t.HREF_TOPIC_ID}" class="topictitle tt-text">{t.TOPIC_TITLE}</a>
 
# 
#-----[ AFTER, ADD ]-[   ]----------------- 
#

{t.RATE_IMG}

# 
#-----[ OPEN ]-[  ]------------------------------ 
# 

templates/{you_theme}/page_header.tpl 

# 
#-----[ FIND ]-[  ]-------------------------------- 
#
<script type="text/javascript" src="{#BB_ROOT}misc/js/jquery.pack.js?v={$bb_cfg['js_ver']}"></script>

# 
#-----[ AFTER ADD ]-[   ]----------------- 
#

<script type="text/javascript" src="{#BB_ROOT}misc/js/jquery.rater.packed.js?v={$bb_cfg['js_ver']}"></script>

# 
#-----[ OPEN ]-[  ]------------------------------ 
# 

templates/{you_theme}/css/main.tpl 

# 
#-----[ ADD ]-[  ]----------------- 
#

.star-rating,
.star-rating a:hover,
.star-rating a:active,
.star-rating a:focus,
.star-rating .current-rating{
  background: url(../images/stars.png) left -1000px repeat-x;
  margin-left: -1px;
}
.star-rating{
  position:relative;
  width:105px;
  height:20px;
  overflow:hidden;
  list-style:none;
  margin:0;
  padding:0;
  background-position: left top;
}
.star-rating li{
  display: inline;
}
.star-rating a,
.star-rating .current-rating{
  position:absolute;
  top:0;
  left:0;
  text-indent:-1000em;
  height:20px;
  line-height:20px;
  outline:none;
  overflow:hidden;
  border: none;
}
.star-rating a:hover,
.star-rating a:active,
.star-rating a:focus{
  background-position: left bottom;
}
.star-rating .current-rating{
  z-index:1;
  background-position: 0% 50%;
  margin-left: 0px;
}

.inline-rating{
  display:-moz-inline-block;
  display:-moz-inline-box;
  display: inline-block;
  vertical-align: middle;
}

.rate {
  margin-top: -3px;
  width: 100%;
}
# 
#-----[ SAVE/CLOSE ALL FILES ]-[ C   ]-- 
# 
#